<template>

<div>
    <view>参数 type：{{type}}</view>
    <map id="122" :longitude="longitude" :latitude="latitude" scale="14" :controls="controls" bindcontroltap="controltap" 
    :markers="markers" bindmarkertap="markertap" :polyline="polyline"  bindregionchange="regionchange" 
    show-location style="width: 100%; height: 350px;">
</map>

<div>
  <view class="address" @click="onChangeAddress">
   <input class='choose-address' placeholder='请选取地点' :value="chooseAddress"/>
  </view>
</div>
</div>

</template>


<script>
import store from '@/utils/store.js'


export default {
   config: {
      navigationBarTitleText: '邻家小铺'
    },
    data() {
      return {
        type:'',
        longitude:0,
        latitude:0,
        markers:[
          {
          id:123,
          latitude:0,
          longitude:0,
          title:'',
          width:12,
          height:14
        }
        ],
        controls:[
          {
            position:{
              left:10,
              top:10,

            }
          }
        ],
        polyline:[{ 
          latitude:0,
          longitude:0,
          }],
        chooseAddress:String
      }
    },
    methods:{
      onChangeAddress: function() {
        var _page = this;
        wx.chooseLocation({
            success: function(res) {
       
            _page.chooseAddress=res.name
            console.log("res>>",res)
          },
          fail: function(err) {
            console.log(err)
          }
        });
      }
    },
    onLoad(options) {
      this.type=options.type
      console.log("type:",options.type)

      const address = store.state.addr
    }
}
</script>

<style>
.card {
  padding: 10px;
}
</style>